import CppHeaderParser
#输入需要打印的头文件
cppHeader = CppHeaderParser.CppHeader(r'test.h',encoding="utf-8")
classes=cppHeader.classes
# 打印每个类的信息
# 打印每个类的信息
for classname in cppHeader.classes.keys():
    print("------------类%s---------："%classname)
    for oneMethod in cppHeader.classes[classname]['methods']['public']:
        print('总: ', oneMethod['debug'])
        print('函数名: ', oneMethod['name'])
        print('返回类型: ', oneMethod['rtnType'])
        print('参数: ', end='')
        if len(oneMethod['parameters']):
            for oneParam in oneMethod['parameters']:
                print(oneParam['name'], oneParam['type'], end='; ')
        print('\n')

    for oneMethod in cppHeader.classes[classname]['methods']['private']:
        print('总: ', oneMethod['debug'])
        print('函数名: ', oneMethod['name'])
        print('返回类型: ', oneMethod['rtnType'])
        print('参数: ', end='')
        if len(oneMethod['parameters']):
            for oneParam in oneMethod['parameters']:
                print(oneParam['name'], oneParam['type'], end='; ')
        print('\n')
    for oneProperty in cppHeader.classes[classname]['properties']['public']:
        print('成员变量名: ', oneProperty['name'])
        print('成员变量类型: ', oneProperty['type'])
        print('\n')
    for oneProperty in cppHeader.classes[classname]['properties']['private']:
        print('成员变量名: ', oneProperty['name'])
        print('成员变量类型: ', oneProperty['type'])
        print('\n')
# for func in cppHeader.functions:
#     print('头文件公共函数名: {}'.format(func['name']))
#     print('返回类型: {}'.format(func['rtnType']))
#     print('参数名: ', func['parameters'][0]['name'])
#     print('函数参数类型: ', func['parameters'][0]['type'])
#     print('总: ', func['debug'])
#     print('\n')
